package laf.learning;

import laf.agents.Correlation;
import laf.agents.LanguageSymbolDictionary;
import laf.env.AttributeIdentifier;
import laf.env.AttributeValue;
import laf.env.State;
import languageacquisition.ontology.LanguageSymbol;

public class DynamicLearningGroundingRule implements GroundingRule {
	
	private double learningRate;
	
	public DynamicLearningGroundingRule(double learningRate) {
		if (learningRate >= 0.0 && learningRate <= 1.0) {
			this.learningRate = learningRate;
		}
		else {
			throw new IllegalArgumentException("Argument 'learningRate' must be real number between 0.0 and 1.0 inclusive");
		}
	}

	@Override
	public double decreaseCorrelation(double correlation, long credibility) {
		return (1.0 - learningRate) * correlation;		
	}

	@Override
	public double increaseCorrelation(double correlation, long credibility) {
		return (1.0 - learningRate) * correlation + learningRate;
	}
}
